﻿package mortal.game.view.guild.cellrender
{
    import Message.Game.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.display.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;

    public class GuildMailMemberListCellRenderer extends GCellRenderer
    {
        private var _emptyBg:Sprite;
        private var _headBorder:GBitmap;
        private var _img:GImageBitmap;
        private var _txtName:GTextFiled;
        private var _txtPosition:GTextFiled;
        private var _checkBox:GCheckBox;
        private var _txtFightValue:GTextFiled;
        private var _txtCarrer:GTextFiled;
        private var _levelBorder:ScaleBitmap;
        private var _txtLv:GTextFiled;
        private var _isCheck:Boolean;

        public function GuildMailMemberListCellRenderer()
        {
            this.buttonMode = true;
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = new GBitmap();
            var _loc_2:* = UIFactory.bg(0, 0, 300, 48, null, ImagesConst.SelectBg);
            this.setStyle("downSkin", _loc_2);
            this.setStyle("overSkin", _loc_2);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_2);
            this.setStyle("selectedOverSkin", _loc_2);
            this.setStyle("selectedUpSkin", _loc_2);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(UIFactory.bg(0, 45, 300, 1, this, ImagesConst.SplitLine));
            this._emptyBg = UIFactory.sprite(0, 0, this);
            this._emptyBg.graphics.beginFill(16777215, 0);
            this._emptyBg.graphics.drawRect(0, 0, 300, 45);
            this._emptyBg.graphics.endFill();
            this._headBorder = UIFactory.gBitmap(ImagesConst.FriendHeadBg, 0, 0, this);
            this._img = UIFactory.gImageBitmap("", 1, 1, this);
            this._txtName = UIFactory.gTextField("", 50, 0, 100, 22, this);
            this._txtPosition = UIFactory.gTextField("", 50, 20, 70, 22, this);
            this._txtCarrer = UIFactory.gTextField("", 155, 0, 40, 22, this);
            this._txtFightValue = UIFactory.gTextField("", 198, 0, 105, 22, this);
            this._checkBox = UIFactory.checkBox("", 268, 15, 23, 23, this);
            this._checkBox.mouseEnabled = false;
            this._checkBox.mouseChildren = false;
            this._levelBorder = UIFactory.bg(0, 24, 21, 18, this, ImagesConst.LevelBg);
            this._txtLv = UIFactory.gTextField("", 0, 22, 40, 22, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._emptyBg.graphics.clear();
            if (this._emptyBg.parent)
            {
                this._emptyBg.parent.removeChild(this._emptyBg);
            }
            this._img.dispose(param1);
            this._txtName.dispose(param1);
            this._txtPosition.dispose(param1);
            this._txtCarrer.dispose(param1);
            this._txtFightValue.dispose(param1);
            this._checkBox.dispose(param1);
            this._txtLv.dispose(param1);
            this._img = null;
            this._txtName = null;
            this._txtPosition = null;
            this._txtCarrer = null;
            this._txtFightValue = null;
            this._checkBox = null;
            this._txtLv = null;
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            var _loc_2:* = param1 as SGuildMember;
            if (_loc_2)
            {
                this._img.imgUrl = AvatarUtil.getPlayerAvatarUrl(_loc_2.miniPlayer.career, _loc_2.miniPlayer.sex, 2);
                this._txtName.htmlText = NameUtil.getNameByCamp(_loc_2.miniPlayer.camp, _loc_2.miniPlayer.name);
                this._txtFightValue.htmlText = Language.getString(71101) + HTMLUtil.addColor(_loc_2.miniPlayer.combat.toString(), GlobalStyle.colorChen);
                this._txtPosition.htmlText = GameDefConfig.instance.getGuildPositonHtmlName(_loc_2.position);
                this._txtLv.text = _loc_2.miniPlayer.level.toString();
                this._txtCarrer.htmlText = GameDefConfig.instance.getCarrer(_loc_2.miniPlayer.career);
            }
            return;
        }// end function

        override public function get data() : Object
        {
            return super.data;
        }// end function

        public function get isCheck() : Boolean
        {
            return this._isCheck;
        }// end function

        public function set isCheck(param1:Boolean) : void
        {
            this._isCheck = param1;
            this._checkBox.selected = this._isCheck;
            return;
        }// end function

    }
}
